<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GtkTextMark</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GTK+ 2 Reference Manual">
<link rel="up" href="TextWidgetObjects.html" title="Multiline Text Editor">
<link rel="prev" href="GtkTextIter.html" title="GtkTextIter">
<link rel="next" href="GtkTextBuffer.html" title="GtkTextBuffer">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="GtkTextIter.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="TextWidgetObjects.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GTK+ 2 Reference Manual</th>
<td><a accesskey="n" href="GtkTextBuffer.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#GtkTextMark.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#GtkTextMark.description" class="shortcut">Description</a>
                   | 
                  <a href="#GtkTextMark.object-hierarchy" class="shortcut">Object Hierarchy</a>
                   | 
                  <a href="#GtkTextMark.properties" class="shortcut">Properties</a>
</td></tr>
</table>
<div class="refentry">
<a name="GtkTextMark"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GtkTextMark.top_of_page"></a>GtkTextMark</span></h2>
<p>GtkTextMark — A position in the buffer preserved across buffer modifications</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="GtkTextMark.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gtk/gtk.h&gt;

struct              <a class="link" href="GtkTextMark.html#GtkTextMark-struct" title="struct GtkTextMark">GtkTextMark</a>;
<a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="returnvalue">GtkTextMark</span></a> *       <a class="link" href="GtkTextMark.html#gtk-text-mark-new" title="gtk_text_mark_new ()">gtk_text_mark_new</a>                   (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> left_gravity</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="GtkTextMark.html#gtk-text-mark-set-visible" title="gtk_text_mark_set_visible ()">gtk_text_mark_set_visible</a>           (<em class="parameter"><code><a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a> *mark</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> setting</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GtkTextMark.html#gtk-text-mark-get-visible" title="gtk_text_mark_get_visible ()">gtk_text_mark_get_visible</a>           (<em class="parameter"><code><a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a> *mark</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GtkTextMark.html#gtk-text-mark-get-deleted" title="gtk_text_mark_get_deleted ()">gtk_text_mark_get_deleted</a>           (<em class="parameter"><code><a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a> *mark</code></em>);
const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       <a class="link" href="GtkTextMark.html#gtk-text-mark-get-name" title="gtk_text_mark_get_name ()">gtk_text_mark_get_name</a>              (<em class="parameter"><code><a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a> *mark</code></em>);
<a class="link" href="GtkTextBuffer.html" title="GtkTextBuffer"><span class="returnvalue">GtkTextBuffer</span></a> *     <a class="link" href="GtkTextMark.html#gtk-text-mark-get-buffer" title="gtk_text_mark_get_buffer ()">gtk_text_mark_get_buffer</a>            (<em class="parameter"><code><a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a> *mark</code></em>);
<a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GtkTextMark.html#gtk-text-mark-get-left-gravity" title="gtk_text_mark_get_left_gravity ()">gtk_text_mark_get_left_gravity</a>      (<em class="parameter"><code><a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a> *mark</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="GtkTextMark.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
  <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>
   +----GtkTextMark
</pre>
</div>
<div class="refsect1">
<a name="GtkTextMark.properties"></a><h2>Properties</h2>
<pre class="synopsis">
  "<a class="link" href="GtkTextMark.html#GtkTextMark--left-gravity" title='The "left-gravity" property'>left-gravity</a>"             <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write / Construct Only
  "<a class="link" href="GtkTextMark.html#GtkTextMark--name" title='The "name" property'>name</a>"                     <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Read / Write / Construct Only
</pre>
</div>
<div class="refsect1">
<a name="GtkTextMark.description"></a><h2>Description</h2>
<p>
You may wish to begin by reading the <a class="link" href="TextWidget.html" title="Text Widget Overview">text widget
conceptual overview</a> which gives an overview of all the objects and data
types related to the text widget and how they work together.
</p>
<p>
A <a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a> is like a bookmark in a text buffer; it preserves a position in
the text. You can convert the mark to an iterator using
<a class="link" href="GtkTextBuffer.html#gtk-text-buffer-get-iter-at-mark" title="gtk_text_buffer_get_iter_at_mark ()"><code class="function">gtk_text_buffer_get_iter_at_mark()</code></a>. Unlike iterators, marks remain valid across
buffer mutations, because their behavior is defined when text is inserted or
deleted. When text containing a mark is deleted, the mark remains in the
position originally occupied by the deleted text. When text is inserted at a
mark, a mark with <em class="firstterm">left gravity</em> will be moved to the
beginning of the newly-inserted text, and a mark with <em class="firstterm">right
gravity</em> will be moved to the end.
<sup>[<a name="id705018" href="#ftn.id705018" class="footnote">3</a>]</sup>
</p>
<p>
Marks are reference counted, but the reference count only controls the validity
of the memory; marks can be deleted from the buffer at any time with
<a class="link" href="GtkTextBuffer.html#gtk-text-buffer-delete-mark" title="gtk_text_buffer_delete_mark ()"><code class="function">gtk_text_buffer_delete_mark()</code></a>. Once deleted from the buffer, a mark is
essentially useless.
</p>
<p>
Marks optionally have names; these can be convenient to avoid passing the
<a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a> object around.
</p>
<p>
Marks are typically created using the <a class="link" href="GtkTextBuffer.html#gtk-text-buffer-create-mark" title="gtk_text_buffer_create_mark ()"><code class="function">gtk_text_buffer_create_mark()</code></a> function.
</p>
</div>
<div class="refsect1">
<a name="GtkTextMark.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GtkTextMark-struct"></a><h3>struct GtkTextMark</h3>
<pre class="programlisting">struct GtkTextMark;</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-text-mark-new"></a><h3>gtk_text_mark_new ()</h3>
<pre class="programlisting"><a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="returnvalue">GtkTextMark</span></a> *       gtk_text_mark_new                   (<em class="parameter"><code>const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> left_gravity</code></em>);</pre>
<p>
Creates a text mark. Add it to a buffer using <a class="link" href="GtkTextBuffer.html#gtk-text-buffer-add-mark" title="gtk_text_buffer_add_mark ()"><code class="function">gtk_text_buffer_add_mark()</code></a>.
If <em class="parameter"><code>name</code></em> is <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, the mark is anonymous; otherwise, the mark can be 
retrieved by name using <a class="link" href="GtkTextBuffer.html#gtk-text-buffer-get-mark" title="gtk_text_buffer_get_mark ()"><code class="function">gtk_text_buffer_get_mark()</code></a>. If a mark has left 
gravity, and text is inserted at the mark's current location, the mark 
will be moved to the left of the newly-inserted text. If the mark has 
right gravity (<em class="parameter"><code>left_gravity</code></em> = <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>), the mark will end up on the 
right of newly-inserted text. The standard left-to-right cursor is a 
mark with right gravity (when you type, the cursor stays on the right
side of the text you're typing).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
<td>mark name or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>left_gravity</code></em> :</span></p></td>
<td>whether the mark should have left gravity</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>new <a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.12</p>
</div>
<hr>
<div class="refsect2">
<a name="gtk-text-mark-set-visible"></a><h3>gtk_text_mark_set_visible ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gtk_text_mark_set_visible           (<em class="parameter"><code><a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a> *mark</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> setting</code></em>);</pre>
<p>
Sets the visibility of <em class="parameter"><code>mark</code></em>; the insertion point is normally
visible, i.e. you can see it as a vertical bar. Also, the text
widget uses a visible mark to indicate where a drop will occur when
dragging-and-dropping text. Most other marks are not visible.
Marks are not visible by default.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>mark</code></em> :</span></p></td>
<td>a <a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>setting</code></em> :</span></p></td>
<td>visibility of mark</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-text-mark-get-visible"></a><h3>gtk_text_mark_get_visible ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gtk_text_mark_get_visible           (<em class="parameter"><code><a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a> *mark</code></em>);</pre>
<p>
Returns <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the mark is visible (i.e. a cursor is displayed
for it).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>mark</code></em> :</span></p></td>
<td>a <a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if visible</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-text-mark-get-deleted"></a><h3>gtk_text_mark_get_deleted ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gtk_text_mark_get_deleted           (<em class="parameter"><code><a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a> *mark</code></em>);</pre>
<p>
Returns <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the mark has been removed from its buffer
with <a class="link" href="GtkTextBuffer.html#gtk-text-buffer-delete-mark" title="gtk_text_buffer_delete_mark ()"><code class="function">gtk_text_buffer_delete_mark()</code></a>. See <a class="link" href="GtkTextBuffer.html#gtk-text-buffer-add-mark" title="gtk_text_buffer_add_mark ()"><code class="function">gtk_text_buffer_add_mark()</code></a>
for a way to add it to a buffer again.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>mark</code></em> :</span></p></td>
<td>a <a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>whether the mark is deleted</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-text-mark-get-name"></a><h3>gtk_text_mark_get_name ()</h3>
<pre class="programlisting">const <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *       gtk_text_mark_get_name              (<em class="parameter"><code><a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a> *mark</code></em>);</pre>
<p>
Returns the mark name; returns NULL for anonymous marks.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>mark</code></em> :</span></p></td>
<td>a <a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>mark name</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-text-mark-get-buffer"></a><h3>gtk_text_mark_get_buffer ()</h3>
<pre class="programlisting"><a class="link" href="GtkTextBuffer.html" title="GtkTextBuffer"><span class="returnvalue">GtkTextBuffer</span></a> *     gtk_text_mark_get_buffer            (<em class="parameter"><code><a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a> *mark</code></em>);</pre>
<p>
Gets the buffer this mark is located inside,
or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the mark is deleted.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>mark</code></em> :</span></p></td>
<td>a <a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the mark's <a class="link" href="GtkTextBuffer.html" title="GtkTextBuffer"><span class="type">GtkTextBuffer</span></a>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-text-mark-get-left-gravity"></a><h3>gtk_text_mark_get_left_gravity ()</h3>
<pre class="programlisting"><a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            gtk_text_mark_get_left_gravity      (<em class="parameter"><code><a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a> *mark</code></em>);</pre>
<p>
Determines whether the mark has left gravity.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>mark</code></em> :</span></p></td>
<td>a <a class="link" href="GtkTextMark.html" title="GtkTextMark"><span class="type">GtkTextMark</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the mark has left gravity, <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> otherwise</td>
</tr>
</tbody>
</table></div>
</div>
</div>
<div class="refsect1">
<a name="GtkTextMark.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="GtkTextMark--left-gravity"></a><h3>The <code class="literal">"left-gravity"</code> property</h3>
<pre class="programlisting">  "left-gravity"             <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write / Construct Only</pre>
<p>Whether the mark has left gravity.</p>
<p>Default value: FALSE</p>
</div>
<hr>
<div class="refsect2">
<a name="GtkTextMark--name"></a><h3>The <code class="literal">"name"</code> property</h3>
<pre class="programlisting">  "name"                     <a href="http://library.gnome.org/devel/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a>*                : Read / Write / Construct Only</pre>
<p>Mark name.</p>
<p>Default value: NULL</p>
</div>
</div>
<div class="footnotes">
<br><hr width="100" align="left">
<div class="footnote"><p><sup>[<a id="ftn.id705018" href="#id705018" class="para">3</a>] </sup>
"left" and "right" here refer to logical direction (left is the toward the start
of the buffer); in some languages such as Hebrew the logically-leftmost text is
not actually on the left when displayed.
</p></div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>